package com.xc.h05.service.renMengBinService.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.xc.h05.entity.Usermark;
import com.xc.h05.mapper.UsermarkMapper;
import com.xc.h05.service.renMengBinService.UsermarkService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UsermarkServiceImpl implements UsermarkService {
    @Autowired
    private UsermarkMapper usermarkMapper;
    @Override
    public int add(Usermark usermark) {
        int add = usermarkMapper.add(usermark);
        return add;
    }


    //删除1
    @Override
    public int remove(Long id) {
        int i = usermarkMapper.deleteByPrimaryKey(id);
        return i;
    }

    @Override
    public int update(Usermark usermark) {
        int i = usermarkMapper.updateByPrimaryKey(usermark);
        return i;
    }

    @Override
    public int removeByIds(List<Long> ids) {
        int i = usermarkMapper.deleteByIds(ids);
        return i;
    }

    @Override
    public PageInfo<Usermark> selectAll(int pageNum, int pageSize, Usermark usermark) {
        PageHelper.startPage(pageNum, pageSize);
        List<Usermark> list = usermarkMapper.selectAll(usermark);
        PageInfo<Usermark> pageInfo = new PageInfo<>(list);
        return pageInfo;
    }

}
